<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>接口文档</title>
</head>

<body>
  <button class="btn">用户登录</button>
  <script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
  <script>
    // 用户注册
    // axios({
    //   url: 'http://hmajax.itheima.net/api/register',
    //   method: 'post',
    //   data: {
    //     username: 'itheima007',
    //     password: '7654321'
    //   }
    // })

    document.querySelector('.btn').addEventListener('click', () => {
      // 用户登录
      axios({
        url: 'http://hmajax.itheima.net/api/login',
        method: 'post',
        data: {
          username: 'itheima007',
          password: '7654321'
        }
      })
    })
  </script>
</body>

</html>